<?php
/**
 * Created by PhpStorm.
 * User: chengenghong
 * Date: 2021-09-18
 * Time: 15:48
 */
namespace G244\Builder;

class Director
{
    /**
     * @var Builder
     */
    private $builder;

    /**
     * The Director works with any builder instance that the client code passes
     * to it. This way, the client code may alter the final type of the newly
     * assembled product.
     */
    public function setBuilder(Builder $builder): void
    {
        $this->builder = $builder;
    }

    /**
     * The Director can construct several product variations using the same
     * building steps.
     */
    public function buildMinimalViableProduct(): void
    {
        $this->builder->productPartA();
    }

    public function buildFullFeaturedProduct(): void
    {
        $this->builder->productPartA();
        $this->builder->productPartB();
        $this->builder->productPartC();
    }
}
